import Vue from 'vue'
import VueRouter from 'vue-router'
import Home from '@/views/Home'
import Seek from '@/views/Seek'
import My from '@/views/My'
import Consult from '@/views/Consult'
import Login from '@/views/Login'
import Register from '@/views/Register'
import Layout from '@/views/Layout'
import Location from '@/views/Location'
import Collect from '@/views/Collect'
import Manage from '@/views/Manage'
import RentOut from '@/views/RentOut'

Vue.use(VueRouter)

const routes = [
  {
    // 重定向
    path: '/',
    redirect: '/layout'
  },
  {
    path: '/layout',
    component: Layout,
    children: [
      {
        path: '/home',
        component: Home
      },
      {
        path: '/seek',
        component: Seek
      },
      {
        path: '/my',
        component: My
      },
      {
        path: '/consult',
        component: Consult
      }
    ]
  },
  {
    path: '/login',
    component: Login
  },
  {
    path: '/location',
    component: Location
  },
  {
    path: '/register',
    component: Register
  },
  {
    path: '/collect',
    component: Collect
  },
  {
    path: '/manage',
    component: Manage
  },
  {
    path: '/rentOut',
    component: RentOut
  }
]

const router = new VueRouter({
  routes
})

export default router
